#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
const int N=100005,M=1005;
struct Node{int a,b;}f1[N],f2[N];
bool cmp(Node x,Node y){return x.a<y.a;}
int n,m1,m2,ans;
priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > >q;
int s1[100010],s2[100010];
int fl1[100010],fl2[100010];
int ans1[100010],ans2[100010];
int main()
{
	freopen("airport.in","r",stdin);
	freopen("airport.out","w",stdout);
	scanf("%d%d%d",&n,&m1,&m2);
	for(int i=1;i<=m1;++i)scanf("%d%d",&f1[i].a,&f1[i].b);
	sort(f1+1,f1+1+m1,cmp);
	for(int i=1;i<=m2;++i)scanf("%d%d",&f2[i].a,&f2[i].b);
	sort(f2+1,f2+1+m2,cmp);
	for(int i=1,fl=1;i<=m1;++i)
	{
		while(!q.empty()&&f1[q.top().second].b<f1[i].a)
		{
			s1[fl1[q.top().second]]=0;
			if(fl1[q.top().second]<fl)fl=fl1[q.top().second];
			q.pop();
		}
		q.push(make_pair(f1[i].b,i)),s1[fl]=i,fl1[i]=fl,++ans1[fl];
		while(s1[fl])++fl;
	}
	while(!q.empty())q.pop();
	for(int i=1,fl=1;i<=m2;++i)
	{
		while(!q.empty()&&f2[q.top().second].b<f2[i].a)
		{
			s2[fl2[q.top().second]]=0;
			if(fl2[q.top().second]<fl)fl=fl2[q.top().second];
			q.pop();
		}
		q.push(make_pair(f2[i].b,i)),s2[fl]=i,fl2[i]=fl,++ans2[fl];
		while(s2[fl])++fl;
	}
	for(int i=1;i<=n;++i)ans1[i]+=ans1[i-1];
	for(int i=1;i<=n;++i)ans2[i]+=ans2[i-1];
	for(int i=0;i<=n;++i)ans=max(ans,ans1[i]+ans2[n-i]);
	printf("%d\n",ans);
	fclose(stdin);
	fclose(stdout);
	return 0;
}
